<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="user.User"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%User user = (User)request.getSession().getAttribute("user");
	if(user!=null&&user.getUser_role().iterator().next().getId()==3){
%>
<tiles:insertTemplate template="/WEB-INF/layout_admin/layout.jsp" flush="true"> 
	<tiles:putAttribute name="body" >
		<div class="main-content">
			<c:forEach items="${videoMatrixList}" var="videoMatrix" varStatus="statu">
				${videoMatrix.name}
				<a href="updateVideoMatrix.action?videoMatrix.id=${videoMatrix.id}">修改</a>  
				<a href="deleteVideoMatrix.action?videoMatrix.id=${videoMatrix.id}" onclick="return confirm('您是否删除')">删除</a><br />
			</c:forEach>
			
			<s:form action="addVideoMatrix" method="POST" enctype="multipart/form-data">
				<s:textfield name="videoMatrix.name" label="产品名称" />
				<s:textfield name="videoMatrix.model" label="产品型号" />
				<s:textfield name="videoMatrix.inputCount" label="输入数量" />
				<s:textfield name="videoMatrix.outputCount" label="输出数量" />
				<s:textfield name="videoMatrix.infraredControl" label="红外控制" />
				<s:textfield name="videoMatrix.differentControl" label="分空控制" />
				<s:textfield name="videoMatrix.protocol" label="协议" />
				<s:textfield name="videoMatrix.informationInterface" label="通信接口" />
				<s:textfield name="videoMatrix.baudRate" label="多波特率" />
				<s:textfield name="videoMatrix.protectCircuit" label="保护电路" />
				<s:textfield name="videoMatrix.box" label="机箱" />
				<s:textfield name="videoMatrix.temperature" label="工作温度" />
				<s:file name="photo" label="产品图片" />
				
				<input type="hidden" name="videoMatrix.id" value="${videoMatrix.id}"/>
				
				<s:submit name="增加" label="增加" />
			</s:form>
        </div>
		
	</tiles:putAttribute>
</tiles:insertTemplate> 
<%} %>
<%User user2 = (User)request.getSession().getAttribute("user");
	if(user2==null||user2.getUser_role().iterator().next().getId()==2){
%>
	<tiles:insertTemplate template="/WEB-INF/layout/layout_product.jsp" flush="true"> 
		<tiles:putAttribute name="right" >
			<div class="main-content">
				<c:forEach items="${videoMatrixList}" var="videoMatrix" varStatus="statu">
					<table width="500" border="1">
						<tr>
							<td width="159"><a href="toShowVideoMatrix.action?videoMatrix.id=${videoMatrix.id}"><img src="videoMatrixPhoto.action?videoMatrix.id=${videoMatrix.id}" width="155" height="130"/></a></td>
							 <td colspan="4" width="325">
							 	<p>产品名称：${videoMatrix.name}</p>
							 	<p>产品型号：${videoMatrix.model}</p>
							 </td>
					    </tr>
					</table>
				</c:forEach>
				第${paginationVideoMatrix.no}页
				共${paginationVideoMatrix.pageSum}页
				<s:if test="!paginationVideoMatrix.isFirst()">
		   		<a href="toAddVideoMatrix.action?paginationVideoMatrix.no=${1}">首页</a>
		   		</s:if>
		   		<s:if test="paginationVideoMatrix.isPrevious()">
		   		<a href="toAddVideoMatrix.action?paginationVideoMatrix.no=${paginationVideoMatrix.no-1}">上一页 </a>
		   		</s:if>
		   		<s:if test="paginationVideoMatrix.isNext()">
		   		<a href="toAddVideoMatrix.action?paginationVideoMatrix.no=${paginationVideoMatrix.no+1}">下一页 </a>
		   		</s:if>
		   		<s:if test="!paginationVideoMatrix.isLast()">
		   		<a href="toAddVideoMatrix.action?paginationVideoMatrix.no=${paginationVideoMatrix.pageSum}">末页</a>
		   		</s:if>
		    </div>
		</tiles:putAttribute>
	</tiles:insertTemplate> 

<%} %>
</body>
</html>